﻿
using Xacml.Core.Interfaces;
using Xacml.Core.Runtime;

namespace Xacml.Core.Runtime.Functions
{
  public class NotFunction : FunctionBase
  {
    public override string Id
    {
      get
      {
        return "urn:oasis:names:tc:xacml:1.0:function:not";
      }
    }

    public override IDataType Returns
    {
      get
      {
        return (IDataType) DataTypeDescriptor.Boolean;
      }
    }

    public override IDataType[] Arguments
    {
      get
      {
        return new IDataType[1]
        {
          (IDataType) DataTypeDescriptor.Boolean
        };
      }
    }

    public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args)
    {
		return new EvaluationValue((object)(!this.GetBooleanArgument(args, 0) ? true : false), (IDataType)DataTypeDescriptor.Boolean);
    }
  }
}
